package com.tanhua.app.service;

import com.tanhua.app.interceptor.UserHolder;
import com.tanhua.dubbo.api.UserApi;
import com.tanhua.model.pojo.User;
import com.tanhua.model.vo.HuanXinUserVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HuanXinService {

    @DubboReference
    private UserApi userApi;

    //查找环信信息
    public HuanXinUserVo findHXInfo() {
        User user = userApi.findById(UserHolder.getUserId());
        if (user ==null){
            return null;
        }
        HuanXinUserVo vo = new HuanXinUserVo();
        vo.setUsername(user.getHxUser());
        vo.setPassword(user.getHxPassword());
        return vo;
    }
}
